package com.ssy.lingxi.member.merchant.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 渠道会员类型枚举
 * @author 万宁
 * @version 2.0.0
 * @date 2020-08-26
 */
public enum MemberChannelTypeEnum {
    /**
     * 电商渠道 - 1
     */
    ECOMMERCE(1, "电商渠道"),

    /**
     * 线下渠道 - 2
     */
    OFFLINE(2, "线下渠道");

    private final Integer code;

    MemberChannelTypeEnum(Integer code, String message) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.getCode());
    }

    public static String getMsg(Integer value) {
        return LanguageHolder.getName(MemberChannelTypeEnum.class, value);
    }

    public static List<Integer> toList() {
        return Arrays.stream(MemberChannelTypeEnum.values()).map(MemberChannelTypeEnum::getCode).collect(Collectors.toList());
    }
}
